<script lang="ts" setup>
import { usePublicityManagement, getPublicityTypeLabel } from '@/composables/usePublicityManagement'
import { PublicityType } from '@/api/athlete/types'

// 使用公示管理 composable，传入变更公示类型
const { loading, autoPublish, handleAutoPublishChange, handlePublishClick } = usePublicityManagement(PublicityType.CHANGE)

// 获取公示类型标签
const publicityTypeLabel = getPublicityTypeLabel(PublicityType.CHANGE)
</script>

<template>
	<div class="flex-1 flex flex-col min-h-0 p-5 rounded">
		<!-- 顶部操作区 -->
		<div class="flex items-center">
			<div class="text-lg font-600 text-primary mr-8">{{ publicityTypeLabel }}管理</div>
			<el-checkbox
				v-model="autoPublish"
				:disabled="loading"
				label="自动公示审核通过的运动员"
				@change="handleAutoPublishChange"
			/>
			<el-button
				type="primary"
				class="ml-auto"
				:loading="loading"
				@click="handlePublishClick"
			>
				发布新{{ publicityTypeLabel }}
			</el-button>
		</div>
	</div>
</template>
